
package cn.javaxc.mvcwork.modules.admin;
import cn.javaxc.mvcwork.framework.actions.TActionContext;
import cn.javaxc.mvcwork.framework.beans.TFormBean;
import cn.javaxc.mvcwork.framework.database.ConnectionElement;
import cn.javaxc.mvcwork.modules.admin.User;
import cn.javaxc.mvcwork.util.common.*;
import java.sql.*;
import java.text.DateFormat;
import java.util.*;
import org.apache.log4j.Level;
import com.fasterxml.jackson.annotation.JsonIgnore;




public class Contact extends TFormBean {

  private static final long serialVersionUID = -177466129659625417L;

  
  protected String permission = "contacts-external_contacts";

  
  public final static int EMPLOYEE_TYPE = 1;
  public final static int LEAD_TYPE = 2;
  public final static int LEAD_UNREAD = 0;
  public final static int LEAD_UNPROCESSED = 1;
  public final static int LEAD_ASSIGNED = 2;
  public final static int LEAD_TRASHED = 3;
  public final static int LEAD_WORKED = 4;

  private int id = -1;
  private int orgId = -1;
  private String orgName = "";
  private String company = "";
  private String accountNumber = "";
  private String title = "";
  private int department = -1;
  private String nameSalutation = "";
  private int listSalutation = -1;
  private int orgSiteId = -1;
  private boolean prospectClient = false;
  private boolean noEmail = false;
  private boolean noMail = false;
  private boolean noPhone = false;
  private boolean noTextMessage = false;
  private boolean noInstantMessage = false;
  private boolean noFax = false;
  private String nameFirst = "";
  private String nameMiddle = "";
  private String nameLast = "";
  private String nameSuffix = "";
  private int assistant = -1;
  private String additionalNames = "";
  private String nickname = "";
  private String role = "";
  private java.sql.Timestamp birthDate = null;
  private String site = "";
  private String notes = "";
  private int locale = -1;
  private String employeeId = null;
  private int employmentType = -1;
  private String startOfDay = "";
  private String endOfDay = "";
  private java.sql.Timestamp entered = null;
  private java.sql.Timestamp modified = null;
  private int enteredBy = -1;
  private int modifiedBy = -1;
  private boolean enabled = true;
  private boolean hasAccount = false;
  private boolean excludedFromCampaign = false;
  private int owner = -1;
  private int custom1 = -1;
  private String url = null;
  private Object userId = -1;
  private int accessType = -1;
  private int clientId = -1;
  private int statusId = -1;
  private int importId = -1;
  private boolean isLead = false;
  private int leadStatus = -1;
  private int source = -1;
  private int rating = -1;
  private int stage = -1;
  private String comments = null;
  private java.sql.Timestamp conversionDate = null;
  private java.sql.Timestamp assignedDate = null;
  private java.sql.Timestamp leadTrashedDate = null;
  private String secretWord = null;
  private double revenue = 0;
  private double potential = 0;
  private int industryTempCode = -1;
  private String city = null;
  private String postalcode = null;
  private int siteId = -1;
  private String siteName = null;
  private String importName = null;


  private String departmentName = "";
  private String ownerName = "";
  private String enteredByName = "";
  private String modifiedByName = "";
  private String industryName = "";
  private String sourceName = "";
  private String ratingName = "";
  private String stageName = "";

  private boolean orgEnabled = true;
  private java.sql.Timestamp orgTrashedDate = null;
  private boolean hasEnabledOwnerAccount = true;
  private boolean hasEnabledAccount = true;

  private boolean primaryContact = false;
  private boolean employee = false;
  private boolean hasOpportunities = false;
  private ArrayList typeList = null;

  private boolean buildDetails = true;
  private boolean buildTypes = true;
  private boolean hasAccess = false;
  private boolean isEnabled = false;

  private java.sql.Timestamp trashedDate = null;
  private boolean forceDelete = false;
  private boolean checkRevertingBackToLead = false;

  private int employees = -1;
  private String dunsType = null;
  private String dunsNumber = null;
  private String businessNameTwo = null;
  private int sicCode = -1;
  private int yearStarted = -1;
  private String sicDescription = null;
	private String avatar;
  //Logger
  private static long milies = -1;
  //private static Logger logger = Logger.getLogger(Contact.class);

  static {
    if (System.getProperty("DEBUG") != null) {
    //  logger.setLevel(Level.DEBUG);
    }
  }

  //filter used by xml api to retrieve the contact info for a particular user
  private String username = null;
  
  public void setUsername(String tmp) {
    this.username = tmp;
  }
  
  public String getUsername() {
    return username;
  }
  
  
  public String getPermission() {
    if (orgId != -1) {
      permission = "accounts-accounts-contacts";
    } else if (employee) {
      permission = "contacts-internal_contacts";
    }
    return permission;
  }


  
  public String getIndustryName() {
    return industryName;
  }


  
  public String getSourceName() {
    return sourceName;
  }


  
  public String getRatingName() {
    return ratingName;
  }

  
  
  public String getImportName() {
	  return importName;
  }


  
  public String getStageName() {
    return stageName;
  }
  


  
  public String getCity() {
    return city;
  }


  
  public void setCity(String tmp) {
    this.city = tmp;
  }


  
  public String getPostalcode() {
    return postalcode;
  }


  
  public void setPostalcode(String tmp) {
    this.postalcode = tmp;
  }


  
  public void setSiteId(int tmp) {
    this.siteId = tmp;
  }


  
  public void setSiteId(String tmp) {
    this.siteId = Integer.parseInt(tmp);
  }


  
  public int getSiteId() {
    return siteId;
  }


  
  public Contact() {
  }



  
  public Contact( String contactId)  {
    queryRecord( Integer.parseInt(contactId));
  }


  
  public Contact( int contactId)  {
    queryRecord( contactId);
  }


  
  public boolean equals(Object obj) {
    if (this.getId() == ((Contact) obj).getId()) {
      return true;
    }

    return false;
  }


  
  public void build()  {
    queryRecord( this.getId());
  }


  
  public void queryRecord( int contactId)  {

  }


  
  public String getAdditionalNames() {
    return additionalNames;
  }


  
  public void setAdditionalNames(String tmp) {
    this.additionalNames = tmp;
  }


  
  public String getNickname() {
    return nickname;
  }


  
  public void setNickname(String tmp) {
    this.nickname = tmp;
  }


  
  public String getRole() {
    return role;
  }


  
  public void setRole(String tmp) {
    this.role = tmp;
  }


  
  public java.sql.Timestamp getBirthDate() {
    return birthDate;
  }


  
  public String getSecretWord() {
    return secretWord;
  }


  
  public void setSecretWord(String tmp) {
    this.secretWord = tmp;
  }


  
  public void setRevenue(double tmp) {
    this.revenue = tmp;
  }

  
  public void setRevenue(String tmp) {
    try{
      this.revenue = Double.parseDouble(tmp);
    }catch (Exception e) {
      this.revenue = 0;
    }
  }

  
  public void setPotential(double tmp) {
    this.potential = tmp;
  }


  
  public void setPotential(String tmp) {
    this.potential = Double.parseDouble(tmp);
  }


  
  public void setIndustryTempCode(int tmp) {
    this.industryTempCode = tmp;
  }


  
  public void setIndustryTempCode(String tmp) {
    this.industryTempCode = Integer.parseInt(tmp);
  }


  
  public double getRevenue() {
    return revenue;
  }


  
  public double getPotential() {
    return potential;
  }


  
  public double getGrossPotential(int divisor) {
    return (java.lang.Math.round(potential) / (double) divisor);
  }


  
  public int getIndustryTempCode() {
    return industryTempCode;
  }


  
  public void setBirthDate(java.sql.Timestamp tmp) {
    this.birthDate = tmp;
  }


  
  public void setBirthDate(String tmp) {
    this.birthDate = DatabaseUtils.parseTimestamp(tmp, Locale.getDefault(), true);
  }


  
  public void setOwnerName(String ownerName) {
    this.ownerName = ownerName;
  }


  
  public void setHasEnabledOwnerAccount(boolean hasEnabledOwnerAccount) {
    this.hasEnabledOwnerAccount = hasEnabledOwnerAccount;
  }


  
  public void setNoEmail(boolean tmp) {
    this.noEmail = tmp;
  }


  
  public void setEmployee(boolean tmp) {
    this.employee = tmp;
  }


  
  public void setEmployee(String tmp) {
    this.employee = DatabaseUtils.parseBoolean(tmp);
  }


  
  public void setNoMail(boolean tmp) {
    this.noMail = tmp;
  }


  
  public void setNoPhone(boolean tmp) {
    this.noPhone = tmp;
  }


  
  public void setNoPhone(String tmp) {
    this.noPhone = DatabaseUtils.parseBoolean(tmp);
  }


  
  public void setNoTextMessage(boolean tmp) {
    this.noTextMessage = tmp;
  }


  
  public void setNoTextMessage(String tmp) {
    this.noTextMessage = DatabaseUtils.parseBoolean(tmp);
  }


  
  public void setNoInstantMessage(boolean tmp) {
    this.noInstantMessage = tmp;
  }


  
  public void setNoInstantMessage(String tmp) {
    this.noInstantMessage = DatabaseUtils.parseBoolean(tmp);
  }


  
  public void setNoFax(boolean tmp) {
    this.noFax = tmp;
  }


  
  public void setNoFax(String tmp) {
    this.noFax = DatabaseUtils.parseBoolean(tmp);
  }


  
  public void setAccessType(int accessType) {
    this.accessType = accessType;
  }


  
  public void setAccessType(String accessType) {
    this.accessType = Integer.parseInt(accessType);
  }


  
  public void setClientId(int clientId) {
    this.clientId = clientId;
  }


  
  public void setClientId(String clientId) {
    this.clientId = Integer.parseInt(clientId);
  }


  
  public int getClientId() {
    return clientId;
  }


  
  public void setStatusId(int tmp) {
    this.statusId = tmp;
  }


  
  public void setStatusId(String tmp) {
    this.statusId = Integer.parseInt(tmp);
  }


  
  public void setImportId(int tmp) {
    this.importId = tmp;
  }


  
  public void setImportId(String tmp) {
    this.importId = Integer.parseInt(tmp);
  }


  
  public void setHasAccess(boolean tmp) {
    this.hasAccess = tmp;
  }


  
  public void setHasAccess(String tmp) {
    this.hasAccess = DatabaseUtils.parseBoolean(tmp);
  }


  
  public void setIsEnabled(boolean tmp) {
    this.isEnabled = tmp;
  }


  
  public void setIsEnabled(String tmp) {
    this.isEnabled = DatabaseUtils.parseBoolean(tmp);
  }


  
  public void setForceDelete(boolean tmp) {
    this.forceDelete = tmp;
  }


  
  public void setForceDelete(String tmp) {
    this.forceDelete = DatabaseUtils.parseBoolean(tmp);
  }


  
  public boolean getHasAccess() {
    return hasAccess;
  }


  
  public boolean getIsEnabled() {
    return isEnabled;
  }


  
  public void setTrashedDate(java.sql.Timestamp tmp) {
    this.trashedDate = tmp;
  }


  
  public void setTrashedDate(String tmp) {
    this.trashedDate = DatabaseUtils.parseTimestamp(tmp);
  }


  
  public java.sql.Timestamp getTrashedDate() {
    return trashedDate;
  }



  
  public boolean getForceDelete() {
    return forceDelete;
  }


  
  public int getStatusId() {
    return statusId;
  }


  
  public int getImportId() {
    return importId;
  }


  
  public int getAccessType() {
    return accessType;
  }

  
  public boolean getEmployee() {
    return employee;
  }


  
  public boolean getHasEnabledOwnerAccount() {
    return hasEnabledOwnerAccount;
  }


  
  public String getUrl() {
    return url;
  }


  
  public boolean getHasOpportunities() {
    return hasOpportunities;
  }


  
  public void setHasOpportunities(boolean hasOpportunities) {
    this.hasOpportunities = hasOpportunities;
  }


  
  public void setUrl(String url) {
    this.url = url;
  }


  
  public void setPrimaryContact(boolean primaryContact) {
    this.primaryContact = primaryContact;
  }


  
  public void setPrimaryContact(String tmp) {
    this.primaryContact = DatabaseUtils.parseBoolean(tmp);
  }


  
  public void setTypeList(ArrayList typeList) {
    this.typeList = typeList;
  }


  
  public ArrayList getTypeList() {
    return typeList;
  }


  
  public boolean getPrimaryContact() {
    return primaryContact;
  }


  


  
  public int getCustom1() {
    return custom1;
  }


  
  public void setCustom1(int custom1) {
    this.custom1 = custom1;
  }


  
  public boolean hasEnabledAccount() {
    return hasEnabledAccount;
  }


  
  public void setHasEnabledAccount(boolean hasEnabledAccount) {
    this.hasEnabledAccount = hasEnabledAccount;
  }


  
  public void setCustom1(String custom1) {
    this.custom1 = Integer.parseInt(custom1);
  }


  
  public void setBuildDetails(boolean tmp) {
    this.buildDetails = tmp;
  }


  
  public void setBuildTypes(boolean tmp) {
    this.buildTypes = tmp;
  }


  
  public void setBuildTypes(String tmp) {
    this.buildTypes = DatabaseUtils.parseBoolean(tmp);
  }


  
  public String getBusinessNameTwo() {
    return businessNameTwo;
  }


  
  public String getDunsNumber() {
    return dunsNumber;
  }


  
  public String getDunsType() {
    return dunsType;
  }


  
  public int getEmployees() {
    return employees;
  }


  
  public int getSicCode() {
    return sicCode;
  }


  
  public int getYearStarted() {
    return yearStarted;
  }

  public void setSicDescription(String tmp) {
    this.sicDescription = tmp;
  }

  public String getSicDescription() {
    return sicDescription;
  }

  
  public void setBusinessNameTwo(String businessNameTwo) {
    this.businessNameTwo = businessNameTwo;
  }


  
  public void setDunsNumber(String dunsNumber) {
    this.dunsNumber = dunsNumber;
  }


  
  public void setDunsType(String dunsType) {
    this.dunsType = dunsType;
  }


  
  public void setEmployees(int employees) {
    this.employees = employees;
  }


  
  public void setEmployees(String employees) {
    try {
      this.employees = Integer.parseInt(employees);
    } catch (Exception e) {
      this.employees = 0;
    }
  }


  
  public void setSicCode(int sicCode) {
    this.sicCode = sicCode;
  }


  
  public void setSicCode(String sicCode) {
    this.sicCode = Integer.parseInt(sicCode);
  }


  
  public void setYearStarted(int yearStarted) {
    this.yearStarted = yearStarted;
  }


  
  public void setYearStarted(String yearStarted) {
    if (!"".equals(yearStarted) && yearStarted != null) {
      this.yearStarted = Integer.parseInt(yearStarted);
    }
  }


 

  
  public void setId(int tmp) {
    this.id = tmp;
  }


  
  public void setEntered(java.sql.Timestamp tmp) {
    this.entered = tmp;
  }


  
  public void setModified(java.sql.Timestamp tmp) {
    this.modified = tmp;
  }


  
  public void setEntered(String tmp) {
    this.entered = DateUtils.parseTimestampString(tmp);
  }


  
  public void setModified(String tmp) {
    this.modified = DateUtils.parseTimestampString(tmp);
  }


  
  public void setOwner(String owner) {
    this.owner = Integer.parseInt(owner);
  }


  
  public void setOwner(int owner) {
    this.owner = owner;
  }


  
  public void setId(String tmp) {
    this.setId(Integer.parseInt(tmp));
  }


  
  public void setOrgId(int tmp) {
    this.orgId = tmp;
  }


  
  public void setOrgId(String tmp) {
    if (tmp != null) {
      this.orgId = Integer.parseInt(tmp);
    }
  }


  
  public void setProspectClient(boolean prospectClient) {
    this.prospectClient = prospectClient;
  }


  
  public boolean getProspectClient() {
    return prospectClient;
  }


  
  public void setListSalutation(String tmp) {
    if (tmp != null) {
      this.listSalutation = Integer.parseInt(tmp);
    }
  }


  
  public void setListSalutation(int tmp) {
    this.listSalutation = tmp;
  }


  
  public void setOrgSiteId(int orgSiteId) {
    this.orgSiteId = orgSiteId;
  }


  
  public void setOrgSiteId(String tmp) {
    this.orgSiteId = Integer.parseInt(tmp);
  }


  
  public int getOrgSiteId() {
    return orgSiteId;
  }


  
  public void setModifiedByName(String modifiedByName) {
    this.modifiedByName = modifiedByName;
  }


  
  public void setNameSalutation(String tmp) {
    this.nameSalutation = tmp;
  }


  
  public void setNameFirst(String tmp) {
    this.nameFirst = tmp;
  }


  
  public void setEnteredByName(String enteredByName) {
    this.enteredByName = enteredByName;
  }


  
  public void setNameMiddle(String tmp) {
    this.nameMiddle = tmp;
  }


  
  public void setNameLast(String tmp) {
    this.nameLast = tmp;
  }


  
  public void setNameSuffix(String tmp) {
    this.nameSuffix = tmp;
  }


  
  public int getAssistant() {
    return assistant;
  }


  
  public void setAssistant(int tmp) {
    this.assistant = tmp;
  }


  
  public void setAssistant(String tmp) {
    this.assistant = Integer.parseInt(tmp);
  }


  
  public void setCompany(String tmp) {
    this.company = tmp;
  }


  
  public void setAccountNumber(String tmp) {
    this.accountNumber = tmp;
  }


  
  public void setTitle(String tmp) {
    if (tmp != null && tmp.length() > 80) {
      tmp = tmp.substring(0, 79);
    }
    this.title = tmp;
  }


  
  public void setDepartmentName(String tmp) {
    this.departmentName = tmp;
  }


  
  public void setDepartment(int tmp) {
    this.department = tmp;
  }


  
  public void setDepartment(String tmp) {
    this.department = Integer.parseInt(tmp);
  }


  
  public boolean getOrgEnabled() {
    return orgEnabled;
  }


  
  public java.sql.Timestamp getOrgTrashedDate() {
    return orgTrashedDate;
  }


  
  public boolean getNoEmail() {
    return noEmail;
  }


  
  public void setNoEmail(String tmp) {
    this.noEmail = DatabaseUtils.parseBoolean(tmp);
  }


  
  public void setNoMail(String tmp) {
    this.noMail = DatabaseUtils.parseBoolean(tmp);
  }


  
  public boolean getNoMail() {
    return noMail;
  }


  
  public boolean getNoPhone() {
    return noPhone;
  }


  
  public boolean getNoTextMessage() {
    return noTextMessage;
  }


  
  public boolean getNoInstantMessage() {
    return noInstantMessage;
  }


  
  public boolean getNoFax() {
    return noFax;
  }


  
  public void setOrgEnabled(boolean orgEnabled) {
    this.orgEnabled = orgEnabled;
  }


  
  public void setOrgTrashedDate(java.sql.Timestamp tmp) {
    this.orgTrashedDate = tmp;
  }


  
  public void setOrgTrashedDate(String tmp) {
    this.orgTrashedDate = DatabaseUtils.parseTimestamp(tmp);
  }


  
  public void setExcludedFromCampaign(boolean excludedFromCampaign) {
    this.excludedFromCampaign = excludedFromCampaign;
  }



  
  public void setNotes(String tmp) {
    this.notes = tmp;
  }


  
  public void setSite(String tmp) {
    this.site = tmp;
  }


  
  public void setEmploymentType(int tmp) {
    this.employmentType = tmp;
  }


  
  public void setEmploymentType(String tmp) {
    this.employmentType = Integer.parseInt(tmp);
  }


  
  public void setLocale(int tmp) {
    this.locale = tmp;
  }


  
  public void setLocale(String tmp) {
    this.locale = Integer.parseInt(tmp);
  }


  
  public void setEmployeeId(String tmp) {
    this.employeeId = tmp;
  }


  
  public void setStartOfDay(String tmp) {
    this.startOfDay = tmp;
  }


  
  public void setEndOfDay(String tmp) {
    this.endOfDay = tmp;
  }


  
  public void setEnabled(boolean tmp) {
    this.enabled = tmp;
  }


  
  public void setEnabled(String tmp) {
    enabled = ("on".equalsIgnoreCase(tmp) || "true".equalsIgnoreCase(tmp));
  }


  
  public void setEnteredBy(int tmp) {
    this.enteredBy = tmp;
  }


  
  public void setEnteredBy(String tmp) {
    this.enteredBy = Integer.parseInt(tmp);
  }


  
  public void setModifiedBy(int tmp) {
    this.modifiedBy = tmp;
  }


  
  public void setModifiedBy(String tmp) {
    this.modifiedBy = Integer.parseInt(tmp);
  }


  
  public void setHasAccount(boolean tmp) {
    this.hasAccount = tmp;
  }





  
  public void addType(int typeId) {
    if (typeList == null) {
      typeList = new ArrayList();
    }
    typeList.add(String.valueOf(typeId));
  }


  
  public void addType(String typeId) {
    if (typeList == null) {
      typeList = new ArrayList();
    }
    typeList.add(typeId);
  }




  
  public java.sql.Timestamp getEntered() {
    return entered;
  }


  
  public java.sql.Timestamp getModified() {
    return modified;
  }


  
  public Object getUserId() {
    return userId;
  }


  
  public void setUserId(Object tmp) {
    userId = tmp;
  }
  

  
  public String getModifiedByName() {
    return modifiedByName;
  }


  
  public String getEnteredByName() {
    return enteredByName;
  }


  
  public String getOwnerName() {
    return ownerName;
  }


  
  public int getOwner() {
    return owner;
  }


  
  public int getId() {
    return id;
  }


  
  public int getOrgId() {
    return orgId;
  }


  
  public int getListSalutation() {
    return listSalutation;
  }


  
  public void setOrgName(String orgName) {
    this.orgName = orgName;
  }


  
  public String getOrgName() {
    return orgName;
  }


  
  public String getNameSalutation() {
    return nameSalutation;
  }


  
  public String getNameFirst() {
    return nameFirst;
  }


  
  public String getNameMiddle() {
    return nameMiddle;
  }


  
  public String getNameLast() {
    return nameLast;
  }


  
  public String getNameSuffix() {
    return nameSuffix;
  }


  @JsonIgnore  
  public String getNameFull() {
    StringBuffer out = new StringBuffer();

    if (nameSalutation != null && nameSalutation.length() > 0) {
      out.append(nameSalutation + " ");
    }

    if (nameFirst != null && nameFirst.length() > 0) {
      out.append(nameFirst + " ");
    }

    if (nameMiddle != null && nameMiddle.length() > 0) {
      out.append(nameMiddle + " ");
    }

    if (nameLast != null && nameLast.length() > 0) {
      out.append(nameLast + " ");
    }

    if (nameSuffix != null && nameSuffix.length() > 0) {
      out.append(nameSuffix + " ");
    }

    if (out.toString().length() == 0) {
      return company;
    }

    return out.toString().trim();
  }


  @JsonIgnore
  public String getNameFirstLast() {
    StringBuffer out = new StringBuffer();

    if (nameFirst != null && nameFirst.length() > 0) {
      out.append(nameFirst + " ");
    }

    if (nameLast != null && nameLast.length() > 0) {
      out.append(nameLast);
    }

    if (out.toString().length() == 0) {
      return company;
    }

    return out.toString().trim();
  }


  

  @JsonIgnore  
  public String getNameLastFirst() {
    return Contact.getNameLastFirst(nameLast, nameFirst);
  }


  

  public String getCompany() {
    if (company == null || company.trim().equals("")) {
      return orgName;
    } else {
      return company;
    }
  }


  
  public String getAccountNumber() {
    return accountNumber;
  }


  


  
  public String getTitle() {
    return title;
  }


  
  public String getDepartmentName() {
    return departmentName;
  }


  
  public int getDepartment() {
    return department;
  }


 

  



  
  public String getNotes() {
    return notes;
  }


  
  public String getSite() {
    return site;
  }


  
  public int getEmploymentType() {
    return employmentType;
  }


  
  public int getLocale() {
    return locale;
  }


  
  public String getEmployeeId() {
    return employeeId;
  }


  
  public String getStartOfDay() {
    return startOfDay;
  }


  
  public String getEndOfDay() {
    return endOfDay;
  }


  
  public boolean getEnabled() {
    return enabled;
  }


  
  public int getEnteredBy() {
    return enteredBy;
  }


  
  public int getModifiedBy() {
    return modifiedBy;
  }


  
  public boolean excludedFromCampaign() {
    return getExcludedFromCampaign();
  }


  
  public boolean getExcludedFromCampaign() {
    return excludedFromCampaign;
  }


  
  public boolean getIsLead() {
    return isLead;
  }


  
  public void setIsLead(boolean tmp) {
    this.isLead = tmp;
  }


  
  public void setIsLead(String tmp) {
    this.isLead = DatabaseUtils.parseBoolean(tmp);
  }


  
  public int getLeadStatus() {
    return leadStatus;
  }


  
  public void setLeadStatus(int tmp) {
    this.leadStatus = tmp;
  }


  
  public void setLeadStatus(String tmp) {
    this.leadStatus = Integer.parseInt(tmp);
  }




  
  public int getSource() {
    return source;
  }


  
  public void setSource(int tmp) {
    this.source = tmp;
  }


  
  public void setSource(String tmp) {
    this.source = Integer.parseInt(tmp);
  }

  
  
  public int getStage() {
    return stage;
  }


  
  public void setStage(int tmp) {
    this.stage = tmp;
  }


  
  public void setStage(String tmp) {
    this.stage = Integer.parseInt(tmp);
  }
  

  
  public int getRating() {
    return rating;
  }


  
  public void setRating(int tmp) {
    this.rating = tmp;
  }


  
  public void setRating(String tmp) {
    this.rating = Integer.parseInt(tmp);
  }


  
  public String getComments() {
    return comments;
  }


  
  public void setComments(String tmp) {
    this.comments = tmp;
  }


  
  public java.sql.Timestamp getConversionDate() {
    return conversionDate;
  }


  
  public void setConversionDate(java.sql.Timestamp tmp) {
    this.conversionDate = tmp;
  }


  
  public void setConversionDate(String tmp) {
    this.conversionDate = DatabaseUtils.parseTimestamp(tmp);
  }


  
  public java.sql.Timestamp getAssignedDate() {
    return assignedDate;
  }


  
  public void setAssignedDate(java.sql.Timestamp tmp) {
    this.assignedDate = tmp;
  }


  
  public void setAssignedDate(String tmp) {
    this.assignedDate = DatabaseUtils.parseTimestamp(tmp);
  }


  
  public java.sql.Timestamp getLeadTrashedDate() {
    return leadTrashedDate;
  }


  
  public void setLeadTrashedDate(java.sql.Timestamp tmp) {
    this.leadTrashedDate = tmp;
  }


  
  public void setLeadTrashedDate(String tmp) {
    this.leadTrashedDate = DatabaseUtils.parseTimestamp(tmp);
  }


  
  public String getSiteName() {
    return siteName;
  }


  
  public void setSiteName(String tmp) {
    this.siteName = tmp;
  }


  
  public boolean getCheckRevertingBackToLead() {
    return checkRevertingBackToLead;
  }


  
  public void setCheckRevertingBackToLead(boolean tmp) {
    this.checkRevertingBackToLead = tmp;
  }


  
  public void setCheckRevertingBackToLead(String tmp) {
    this.checkRevertingBackToLead = DatabaseUtils.parseBoolean(tmp);
  }


  


  
  public boolean hasAccount() {
    return hasAccount;
  }
	
  
  public static String getNameLastFirst(String nameLast, String nameFirst) {
    StringBuffer out = new StringBuffer();
    if (nameLast != null && nameLast.trim().length() > 0) {
      out.append(nameLast);
    }
    if (nameFirst != null && nameFirst.trim().length() > 0) {
      if (out.length() > 0) {
        out.append(", ");
      }
      out.append(nameFirst);
    }
    if (out.toString().length() == 0) {
      return null;
    }
    return out.toString().trim();
  }

  
  public static String getNameLastFirstAndTitle(String nameLast, String nameFirst, String title) {
		if (title != null && !"".equals(title)) {
			return Contact.getNameLastFirst(nameLast, nameFirst) + " - " + title;
		}
		
		return Contact.getNameLastFirst(nameLast, nameFirst);
	}
	
	
  
  public static String getNameFirstLast(String nameFirst, String nameLast) {
    StringBuffer out = new StringBuffer();
    if (nameFirst != null && nameFirst.trim().length() > 0) {
      out.append(nameFirst);
    }
    if (nameLast != null && nameLast.trim().length() > 0) {
      if (out.length() > 0) {
        out.append(" ");
      }
      out.append(nameLast);
    }
    if (out.toString().length() == 0) {
      return null;
    }
    return out.toString().trim();
  }

  @JsonIgnore
  public String getPrimaryEmailAddress() {
    return "";
  }
	public String getAvatar(){
		return this.avatar;
	}
	public void setAvatar(String avatar){
		this.avatar=avatar;
	}
}
